home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / comm / mail / YAM23src.lha / Source / extrasrc / stcgfe.c < prev    next >
C/C++ Source or Header  |  2000-12-15  |  373b  |  19 lines

  1. #include <string.h>
  2. #include "extra.h"
  3.  
  4. /* Get the filename extension. */
  5.  
  6. int stcgfe(char *ext, const char *name)
  7. {
  8.    const char *p = name + strlen(name);
  9.    const char *q = p;
  10.    while (p > name && *--p != '.' && *p != '/' && *p != ':');
  11.    if (*p++ == '.' && q - p < FESIZE)
  12.    {
  13.       memcpy(ext, p, q - p + 1);
  14.       return q - p;
  15.    }
  16.    *ext = '\0';
  17.    return 0;
  18. }
  19.